
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!--    <meta charset=utf-8">-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>数据库后台</title>
    <!-- BOOTSTRAP STYLES-->
<!--    <link href="../css/bootstrap.css" rel="stylesheet" />-->
    <link href="../css/bootstrap.min.css" rel="stylesheet" />
    <!-- CUSTOM STYLES-->
    <link href="../css/custom.css" rel="stylesheet" />
    <!-- /. WRAPPER  -->
    <!-- SCRIPTS -AT THE BOTOM TO REDUCE THE LOAD TIME-->
    <!-- JQUERY SCRIPTS -->


<!--    <script src="../js/jquery-1.7.1.min.js"></script>-->
    <!-- BOOTSTRAP SCRIPTS -->


<!--    <script src="../js/bootstrap.min.js"></script>-->
    <!-- METISMENU SCRIPTS -->
    <script src="../js/jquery.js"></script>


<!--    <script type="text/javascript" src="../js/bootstrap.min.js"charset="UTF-8"></script>-->
    <script src="../js/common.js"></script>


<!--    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">-->
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>



</head>

<body>
<div id="wrapper">
    <nav class="navbar navbar-default navbar-cls-top " role="navigation"
         style="margin-bottom: 0">
        <div class="navbar-header">
            <!--                 <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-collapse"> -->
            <!--                     <span class="sr-only">Toggle navigation</span> -->
            <!--                     <span class="icon-bar"></span> -->
            <!--                     <span class="icon-bar"></span> -->
            <!--                     <span class="icon-bar"></span> -->
            <!--                 </button> -->
            <a class="navbar-brand">数据反馈</a>
        </div>
        <div
                style="color: white; padding: 15px 50px 5px 50px; float: right; font-size: 16px;">
            <!--            <form action="../loginOut.jsp" method="post">-->
            <button id = "loginout" class="btn btn-danger">注销</button>
            <!--            </form>-->

        </div>
    </nav>
    <!-- /. NAV TOP  -->
    <nav class="navbar-default navbar-side" role="navigation">
        <div class="sidebar-collapse">
            <ul class="nav" id="main-menu">
<!--                <li class="text-center"><img src="<%=img%>"-->
<!--                                             class="user-image img-responsive" /></li>-->


                <!-- 					<li><a href="../index.jsp"><i -->
                <!-- 							class="fa fa-dashboard fa-3x"></i> 主页</a></li> -->
                <!-- 					<li><a href="UserInfo.jsp"><i class="fa fa-table fa-3x"></i> -->
                <!-- 							个人信息</a></li> -->
<!--                <li><a href="TeacherSelfExam.jsp"><i-->
<!--                        class="fa fa-desktop fa-3x"></i> 竞赛批改</a></li>-->
                <li><a href="formsubmit.html"><i class="fa fa-qrcode fa-3x"></i>
                                    表单录入</a></li>
                <li><a href="distribute.html"><i
                        class="fa fa-bar-chart-o fa-3x"></i> 任务分配</a></li>
                <li><a href="feedback.html"><i
                        class="fa fa-bar-chart-o fa-3x"></i> 数据反馈</a></li>
                <li><a href="usermanage.html"><i
                        class="fa fa-bar-chart-o fa-3x"></i> 用户管理</a></li>

                <li><a href="searchlist.html"><i
                        class="fa fa-bar-chart-o fa-3x"></i> 数据查询</a></li>



                <!-- 					<li><a href="ChangePassword.jsp"><i -->
                <!-- 							class="fa fa-edit fa-3x"></i> 密码修改 </a></li> -->

            </ul>

        </div>

    </nav>
    <!-- /. NAV SIDE  -->
    <div id="page-wrapper">
        <div id="page-inner">

            <div class="container">
                <fieldset>
                    <legend>数据反馈</legend>
                    <p>
                        <input type="button" id="searchlist" class="btn btn-primary" value="查找" />
<!--                        <input type="button" id="downloadlist" class="btn btn-primary" value="下载" />-->
                    </p>

                    <div class="row" style="padding: 50px 20px 0px 20px">

                        <div class="table-responsive">
                            <table class="table table-striped" id="table1"
                                   style="text-align: center">
                                <thead>
                                <td>姓名</td>
                                <td>电话</td>
                                <td>关键词</td>
                                <td>地域</td>
                                <td>操作</td>
                                </thead>
                                <tbody>


                                </tbody>
                            </table>
                        </div>
                    </div>

<!--                    <h2>创建模态框（Modal）</h2>-->
                    <!-- 按钮触发模态框 -->
<!--                    <button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal" value="66666">开始演示模态框</button>-->
                    <!-- 模态框（Modal） -->
                    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                        <div class="modal-dialog">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                    <h4 class="modal-title" id="myModalLabel">用户信息反馈</h4>
                                </div>
                                <div class="modal-body">姓名
                                    <input id="customname" type="text" readonly="readonly" />
                                </div>
                                <div class="modal-body">手机号
                                    <input id="phone" type="text" readonly="readonly" />
                                </div>
                                <div class="modal-body">关键词
                                    <input id="keyword" type="text" />
                                </div>
                                <div class="modal-body">地域
                                    <input id="area" type="text"/>
                                </div>
                                <div class="modal-body">是否有效
                                    <select id="selectchoice">
                                        <option value="null"></option>
                                        <option value="1">是</option>
                                        <option value="0">否</option>
                                    </select>
                                </div>
                                <div class="modal-body">备注
                                    <input id="feedbacktext">
                                </input>
                                </div>
<!--                                <div><input id="displayid"/></div>-->
                                <div><input style="display: none" id="displayid"/></div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                    <button type="button" class="btn btn-primary" data-dismiss="modal" id="modify">提交更改</button>
                                </div>
                            </div><!-- /.modal-content -->
                        </div><!-- /.modal -->
                    </div>





                    <div class="col-sm-offset-5 col-sm-7">
                        <input id="ebutton" type="button" value="导出EXCEL"
                               onClick="getXlsFromJsp('table1')" class="btn btn-primary"
                               style="display: none">
                    </div>
                </fieldset>
            </div>
            <!-- /. PAGE INNER  -->
        </div>
        <!-- /. PAGE WRAPPER  -->
    </div>
<!--    <script type="text/javascript" src="../js/AjaxAPI.js" charset="UTF-8"></script>-->
<!--    <script src="../js/jquery.dataTables.js"></script>-->






</div>


    <script type="text/javascript">
        $(document).ready(function () {
            // function valofi(val){
            //     alert(val)
            // }
            //
            // $("button[name='valbtn']").click(function () {
            //        alert(7411)
            // })
            $(document).on('click','.buttomval',function(){
                $("#customname").val("");
                $("#phone").val("");
                $("#keyword").val("");
                $("#area").val("");
                $("#selectchoice").val("");
                $("#feedbacktext").val("");
                $("#displayid").val($(this).val());

                // alert($(this).val());
                let d1 = {
                    id: $(this).val(),
                };
                $.ajax({
                    type: "POST",
                    url: "../feedback/searchone",
                    contentType: "application/json;charset=utf-8",
                    data: JSON.stringify(d1),
                    dataType: "json",
                    success: function (data) {
                        if (data == null) {
                            // window.location.href = "/msgtable/html/login.html"
                            alert("无权限")
                        } else {
                            $("#customname").val(data.realName);
                            $("#phone").val(data.phone);
                            $("#keyword").val(data.keyword);
                            $("#area").val(data.area);
                            $("#selectchoice").val(data.isable);
                            $("#feedbacktext").val(data.label);
                        }
                    },
                    error: function (data) {
                        window.location.href = "/msgtable/html/login.html";
                        alert("请登录")
                    }
                });


            });


            // $(".buttomval").click(function () {
            //     alert(11111)
            //     // alert($(this).val());
            // });

            $("#searchlist").click(function () {
                let d1 = {
                    temp: "temp",
                };
                $.ajax({
                    type: "POST",
                    url: "../feedback/selflist",
                    contentType: "application/json;charset=utf-8",
                    data: JSON.stringify(d1),
                    dataType: "json",
                    success: function (data) {
                        if (data == null) {
                            // window.location.href = "/msgtable/html/login.html"
                            alert("无权限")
                        } else {
                            $('table tbody').html('');
                            $.each(data, function (i, item) {
                                // alert(item.userName)
                                // var _len = $("#tab tr").length;
                                var rowmsg = "<tr id= align='center'>"
                                    + "<td>" + item.realName + "</td>"
                                    + "<td>" + item.phone + "</td>"
                                    + "<td>" + item.keyword + "</td>"
                                    + "<td>" + item.area + "</td>"
                                    + "<td><button class='btn btn-primary buttomval' name='valbtn' data-toggle='modal' data-target='#myModal' value="+item.id +">提交信息</button></td>";
                                // + "<td><input type='checkbox' name='vegetable' value="+item.id+"/></td>";
                                rowmsg = rowmsg + "</tr>";
                                $("#table1").append(rowmsg);

                            })
                        }
                    },
                    error: function (data) {
                        window.location.href = "/msgtable/html/login.html"
                        alert("请登录")
                    }
                });
            });




            $("#modify").click(function () {
                let d1 = {
                    id:$("#displayid").val(),
                    keyword:$("#keyword").val(),
                    area:$("#area").val(),
                    isable:$("#selectchoice").val(),
                    label:$("#feedbacktext").val(),
                };
                $.ajax({
                    type: "POST",
                    url: "../feedback/rebackMsg",
                    contentType: "application/json;charset=utf-8",
                    data: JSON.stringify(d1),
                    dataType: "text",
                    success: function (data) {
                        alert(data)
                        $("#searchlist").click();
                        // $('#myModal').dialog('close');
                    },
                    error: function (data) {
                        window.location.href = "/msgtable/html/login.html"
                        alert("请登录")
                    }
                });
            });

        });
    </script>

</body>
</html>